feat: Add custom_properties to github_repository and github_enterpris…#3322
feat: Add custom_properties to github_repository and github_enterpris…#3322faradayfan wants to merge 3 commits intointegrations:mainfrom
Conversation
|
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with |
9efa7f0 to
c96926f
Compare
c96926f to
b702889
Compare
|
Just to be transparent, I haven't tested these changes manually. They are based on API documentation. I'm planning on testing the repository resource changes, but I don't think I'll be able to test the enterprise custom properties. Is that something a maintainer can validate for me? Or is there a manual testing harness I can use to validate those changes myself? |
|
We're super-interested in this change, and have Enterprise waiting for this automation. If we can help with testing it, just let us know, I'll try to do it. |
7769358 to
6e6e49e
Compare
…e_custom_property resource (integrations#3230, integrations#3304) Allow custom properties to be set on repositories at creation time, fixing 422 errors when an organization enforces required custom properties. Adds a new github_enterprise_custom_property resource and data source for managing custom property definitions at the enterprise level. Uses context-aware CRUD functions, proper 404 handling, and ConfigStateChecks in acceptance tests per maintainer guidelines. Closes integrations#3230, integrations#3304
- include custom_properties in create request body to satisfy org-required property enforcement at creation time - read custom_properties via dedicated GetAllCustomPropertyValues endpoint instead of repo.CustomProperties (which GET /repos never populates) - handle partial and full removal in update via CreateOrUpdateCustomProperties with null values; removing the block entirely leaves existing values intact (Optional+Computed behavior)
Covers all documented config semantics: setting at creation time, updating values, removing individual map keys, clearing via empty map, and the Optional+Computed no-op when the block is removed entirely.
9a9d13c to
3bb27d2
Compare
|
I've validated the custom_properties property on the github_repository resource through manual testing and provided a breakdown of the behavior on the PR summary. |
feat: Add custom_properties to github_repository and github_enterprise_custom_property resource
Allow custom properties to be set on repositories at creation time, fixing 422 errors when an organization enforces required custom properties. Also adds a new github_enterprise_custom_property resource and data source for managing custom property definitions at the enterprise level.
Resolves #3230, #3304
Before the change?
github_repositoryto return a 422 error on creation, since custom properties could only be set via a separategithub_repository_custom_propertyresource applied after creationAfter the change?
github_repositorynow accepts acustom_propertiesargument (a string map) that is included in the initial repository creation request, satisfying organization-required custom properties at creation timegithub_enterprise_custom_propertyresource allows managing custom property definitions at the enterprise level, mirroring the existinggithub_organization_custom_propertiesresourcegithub_enterprise_custom_propertydata source allows reading enterprise custom property definitionsgithub_repositorywith a new argument description and exampletestResourcePrefixnaming andConfigStateCheckspatternPull request checklist
Does this introduce a breaking change?
Behavior Note About
custom_propertiesongithub_repositoryThis change adds a
custom_propertiesattribute togithub_repositorythat allows setting repository-level custom property values defined by the organization.Example
Behavior
Create — Custom properties are included directly in the
POST /orgs/{org}/reposrequest body. This satisfies organizations that enforce required custom properties at repository creation time (which would otherwise reject the request with a422).Update — Changes are applied via the dedicated
PATCH /repos/{owner}/{repo}/properties/valuesendpoint. The general repository update endpoint (PATCH /repos/{owner}/{repo}) silently ignores custom property changes, so the dedicated endpoint is required.Read — Property values are refreshed from
GET /repos/{owner}/{repo}/properties/valueson each plan so out-of-band changes are detected as drift.Config semantics
custom_properties = { key = "value" }null)custom_properties = {}custom_propertiesblockThe last row is intentional and follows Terraform's
Optional + Computedconvention: org-required properties shouldn't be implicitly cleared, and accidental block removal shouldn't wipe values. Usecustom_properties = {}to explicitly clear all values.